import { createStore } from 'vuex'

let store = createStore({
  // 等价于 new Vuex.Store({这个对象})
  state: {
    count: 100
  },
  mutations: {
    add(state, n) {
      state.count += n
    }
  },
  actions: {
    add(store, m) {
      setTimeout(() => {
        store.commit('add', m)
      }, 1000);
    }
  }
})

export default store